#ifndef ENGINEFACTORY_H
#define ENGINEFACTORY_H

#include <string>
#include <vector>
#include <QStringList>
#include <QSharedPointer>
#include "rule_traits.hpp"

struct BaseVisitor
{
    static const QString baseVisitorClassName;
    static const QString baseVisitorHeaderName;
    std::shared_ptr<RuleCollection> visibleRuleCollections;
    /**
     *@deprecated
     */
    std::shared_ptr<RuleCollection> invisibleRuleCollections;
    QStringList visibleContextTypeNames() const;;
    QStringList visibleRuleNames() const;
    QStringList inVisibleRuleNames() const;

};

struct SpecificTypeVisitor : BaseVisitor{
    static const QString specificTypeVisitorHeaderName;
    static const QString specificTypeVisitorImplName;
    QString className;
    QString returnType;
    QString baseType;
    QStringList ruleElements(const QString& ruleName , RuleKind kind) const;
};

namespace Grantlee
{
    class Engine;
    class FileSystemTemplateLoader;
}

using StringPair = QPair<QString,QString>;
class EngineFactory
{
public:
    EngineFactory();
    virtual ~EngineFactory();
    /**
     * @brief genCode
     * @param baseVisitor
     * @return  true : success , false : failed
     */
    QString genCode(const BaseVisitor& baseVisitor);
    StringPair genCode(const SpecificTypeVisitor& baseVisitor);

protected:
    std::unique_ptr<Grantlee::Engine> engine_;
    QSharedPointer<Grantlee::FileSystemTemplateLoader> loader_;


};

#endif // ENGINEFACTORY_H
